//
//  PersonSearchVC.swift
//  SBSafetyApp
//
//  Created by Lina on 2023/11/28.
//

import Foundation
import UIKit

class PersonSearchVC: SubLevelViewController {
    let detailV = PersonSearchView()

    open var didSelectItemWith:((_ nickName: String?, _ jobNum: String?, _ phonenumber: String?) -> ())?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "人员搜索"
        view.backgroundColor = .bg
        
        setupUI()
    }
    
    @objc func submitTapped() {
        didSelectItemWith?(detailV.nameItem.value, detailV.jobItem.value, detailV.phoneItem.value)
        navigationController?.popViewController(animated: true)
    }
    
    // MARK: - Setup
    
    func setupUI() {
        detailV.submitBtn.addTarget(self, action: #selector(submitTapped), for: .touchUpInside)
        view.addSubview(detailV)
        detailV.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
            make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
        }
    }
}
